package cn.gok.homework;

public class Person {
    private String name;
    private String sex;
    private int age;
    private boolean isMarried;//true为结婚

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public boolean isMarried() {
        return isMarried;
    }

    public void setMarried(boolean married) {
        isMarried = married;
    }

    public Person() {
    }

    public Person(String name, String sex, int age, boolean isMarried) {
        this.name = name;
        this.sex = sex;
        this.age = age;
        this.isMarried = isMarried;
    }

    public static boolean marryWith(Person p1,Person p2){
        if ((!(p1.isMarried&&p2.isMarried))&&(p1.sex!=p2.sex||p2.sex!=p1.sex)&&(p1.age>20&&p2.age>19)){
            //返回结婚
            return true;
        }
        //没有结婚
        return false;
    }
    public void study(String school){
        System.out.println(this.name+"在"+school+"学校学习");
    }
    public void study(String school,String time){
        System.out.println(this.name+"在"+school+"学校学习"+time);
    }
}
